var gulp = require('gulp'),
    watch = require('gulp-watch');
var process = require('child_process');
gulp.task('default', function () {
    // Endless stream mode
    return watch('src/**/*.es6', { ignoreInitial: false }, function (Viny) {
        var filename = Viny.path;
        var newname = filename.replace(".es", ".js");
        var cmd = 'babel ' + filename + " -o " + newname;
        process.exec(cmd, function (error, stdout, stderr) {

            console.log(stdout);

        });

    })

});
// var gulp = require('gulp')
// gulp.task('default', function () {

//     // 所有事件都将被监控
//     var watcher = gulp.watch('src/**/*.es', { events: 'all' });
//     watcher.on('change', function (path, stats) {
//         console.log(`File ${path} was changed`);
//     });
// });
